<template>
  <div class="base-container" id="main">
    <t-sticky-tool
      :style="{ position: 'fixed', overflow: 'hidden',zIndex: 1000,}"
      :offset="[-60, 100]"
      @click="handlerOpenDetail"
    >
<!--      <t-sticky-item style="width: 80px"  label="大纲评审记录" >-->
<!--        <template #icon>-->
<!--          <t-icon name="file-paste"></t-icon>-->
<!--        </template>-->
<!--      </t-sticky-item>-->
      <t-sticky-item style="width: 80px"  label="大纲详情" >
        <template #icon>
          <t-icon name="file-paste"></t-icon>
        </template>
      </t-sticky-item>
    </t-sticky-tool>
    <approve-list tab-default-value="3" :header="dialog.header" :objId="dialog.objId" :visible.sync="dialog.open_approve_list"
                  v-if="dialog.open_approve_list"></approve-list>
    <t-loading text="加载中..." :fullscreen="false" attach="#main" :loading="applyLoading" size="medium">
    </t-loading>
    <t-steps  :current="activeForm"
              :onChange="onCurChanged">
      <t-step-item  title="基本信息" :content="isSubmit('contractId')">
      </t-step-item>
      <t-step-item  title="研究的主要目的、内容" :content="isSubmit('purposeContentId')">
      </t-step-item>
      <t-step-item  title="考核指标" :content="isSubmit('assessIndexId')"></t-step-item>
      <t-step-item title="研究的年度计划、目标" :content="isSubmit('researchPlanId')"></t-step-item>
      <t-step-item  title="成果及知识产权的归属与保护" :content="isSubmit('resultsId')"></t-step-item>
      <t-step-item  title="单位信息" :content="isSubmit('companyId')"></t-step-item>
      <t-step-item  title="研究人员" :content="isSubmit('memberId')"></t-step-item>
      <t-step-item  title="项目经费" :content="isSubmit('budgetId')"></t-step-item>
      <t-step-item  title="共同条款" :content="isSubmit('termsId')"></t-step-item>
      <t-step-item title="按专家评审意见修改说明" :content="isSubmit('reviewId')"></t-step-item>
      <t-step-item  title="项目信息表" :content="isSubmit('otherId')"></t-step-item>
      <t-step-item v-if="isOldProject === '1'" title="附件信息" :content="isSubmit('fileId')"></t-step-item>
    </t-steps>
    <t-form ref="form" :key="activeForm" v-if="activeForm === 0" class="step-form" :data="formData0"  :rules="rules0"
            labelWidth="140px">
      <t-alert v-if="site_tag==='jtt'" style="margin-bottom: 14px" theme="info" title="填写说明：">
        <div slot="message">
          <p class="span-txt">
            一、填写任务书（合同）之前，请先阅读《江西省交通运输厅科技项目管理办法》。对任务书（合同）内所列各项内容，应实事求是认真填写、明确表述。外来语要同时用原文和中文表达，第一次出现的缩略词，须注明全称。          </p>
          <p class="span-txt">二、本任务书中规定：委托方（甲方）为厅科技主管部门，承担方（乙方）为项目承担单位，保证方（丙方）为归口管理单位。归口管理单位是项目承担单位的主管部门。</p>
          <p class="span-txt">三、本任务书须采用标准A4纸张，于左侧竖装成册；按表格默认的页面、字体、字号填写；目前标题下若加小标题，则为小四宋体加粗；表格内文字为五号宋体，16磅行距。</p>
          <p class="span-txt">
            四、本任务书均须为原件，需签字的部分可用钢笔或印章填写，字迹要求工整清楚。各项表格如不够可另加附页。</p>
          <p class="span-txt">五、本任务书正式文本由厅科技主管部门和项目承担单位各存两份、各合作单位和保证方（归口管理单位）各存一份。</p>
          <p class="span-txt">六、本任务书附件应包含：项目研究工作大纲、研究工作大纲专家评审意见及专家名单，承担单位与合作单位的合作协议。</p>
          <!--          <p class="span-txt">七、本任务书样式可在江西交通信息网（网址：http//www.jxjt.gov.cn）或江西交通科技信息资源共享平台下载。</p>-->
        </div>
      </t-alert>
      <t-alert v-else style="margin-bottom: 14px" theme="info" title="填写说明：">
        <div slot="message">
          <p class="span-txt">
            一、填写任务书（合同）之前，请先阅读《江西省交通投资集团有限责任公司科技创新管理办法》。对任务书（合同）内所列各项内容，应实事求是认真填写、明确表述。外来语要同时用原文和中文表达，第一次出现的缩略词，须注明全称。
          <p class="span-txt">二、本任务书中规定：委托方（甲方）为集团科技主管部门，承担方（乙方）为项目承担单位，保证方（丙方）为归口管理单位。项目归口管理单位主要指集团直属各单位等有关单位。</p>
          <p class="span-txt">三、本任务书须采用标准A4纸张，于左侧竖装成册；按表格默认的页面、字体、字号填写；目前标题下若加小标题，则为小四宋体加粗；表格内文字为五号宋体，16磅行距。</p>
          <p class="span-txt">
            四、本任务书均须为原件，需签字的部分可用钢笔或印章填写，字迹要求工整清楚。各项表格如不够可另加附页。</p>
          <p class="span-txt">五、本任务书正式文本由集团科技主管部门和项目承担单位各存两份、各合作单位和保证方（归口管理单位）各存一份。</p>
          <p class="span-txt">六、本任务书附件应包含：项目研究工作大纲、研究工作大纲专家评审意见及专家名单，承担单位与合作单位的合作协议。</p>
        </div>
      </t-alert>
      <t-row style="align-items: stretch" :gutter="14">
        <t-col :span="12">
          <t-card class="step-card" size="small" title="基本信息">
            <t-form-item label="项目名称：" name="projectName">
              <t-input  clearable style="width: 390px" v-model="formData0.projectName"></t-input>
            </t-form-item>
<!--            <t-form-item label="项目开始时间：" name="startDate">-->
<!--              <t-date-picker clearable style="width: 390px" v-model="formData0.startDate"></t-date-picker>-->
<!--            </t-form-item>-->
<!--            <t-form-item label="项目结束时间：" name="endDate">-->
<!--              <t-date-picker clearable style="width: 390px" v-model="formData0.endDate"></t-date-picker>-->
<!--            </t-form-item>-->
            <t-form-item label="建议经费总概算：" name="adviceFunding">
              <t-input-adornment append="万元">
                <t-input-number :decimal-places="2"
                                @keyup="()=>{if(formData0.adviceFunding){formData0.adviceFunding=Number((formData0.adviceFunding || 0).toString().match(/^\d+(?:\.\d{0,2})?/))}}"
                                :allowInputOverLimit="false" clearable style="width: calc(390px - 45px)"
                                v-model="formData0.adviceFunding"
                                theme="normal"
                                :min="0"></t-input-number>
              </t-input-adornment>
            </t-form-item>
            <t-form-item :label="site_tag==='jtt'?'申请厅补助经费：':'申请集团补助经费：'" name="subsidyFunding">
              <t-input-adornment append="万元">
                <t-input-number :decimal-places="2"
                                @keyup="()=>{if(formData0.subsidyFunding){formData0.subsidyFunding=Number((formData0.subsidyFunding || 0).toString().match(/^\d+(?:\.\d{0,2})?/))}}"
                                :allowInputOverLimit="false" clearable style="width: calc(390px - 45px)"
                                v-model="formData0.subsidyFunding"
                                theme="normal"
                                :min="0"></t-input-number>
              </t-input-adornment>
            </t-form-item>
            <t-form-item label="任务书开始时间：" name="startDate">
              <t-date-picker clearable style="width: 390px" v-model="formData0.startDate"></t-date-picker>
            </t-form-item>
            <t-form-item label="任务书结束时间：" name="completeDate">
              <t-date-picker clearable style="width: 390px" v-model="formData0.completeDate"></t-date-picker>
            </t-form-item>
          </t-card>
        </t-col>
      </t-row>
      <t-row>
        <t-col :span="11" class="query-form-inline">
          <t-button theme="primary" @click="onSubmit0">下一步</t-button>
        </t-col>
        <t-col :span="1" class="operation-container">
          <t-button variant="outline" @click="close">返回</t-button>
        </t-col>
      </t-row>
    </t-form>
    <t-form v-if="activeForm === 1" labelAlign="top" ref="form" class="step-form" :data="formData1"  :rules="rules1"
            labelWidth="140px">
      <t-form-item label="（一）项目研究的主要目的：" name="goal">
        <tiny-mce-editor :key="activeForm" v-model="formData1.goal"></tiny-mce-editor>
      </t-form-item>
      <t-form-item name="content" label="（二）主要研究内容（拟解决的主要技术难点和问题，主要内容和研究的创新点等）：">
        <tiny-mce-editor :key="activeForm" v-model="formData1.content"></tiny-mce-editor>
      </t-form-item>
      <t-form-item name="dependingSituation" label="（三）本项目的依托工程应用情况：">
        <tiny-mce-editor :key="activeForm" v-model="formData1.dependingSituation"></tiny-mce-editor>
      </t-form-item>
      <t-row>
        <t-col :span="11" class="query-form-inline">
          <t-button @click="onCurChanged(0)" theme="primary" variant="base">上一步</t-button>
          <t-button theme="primary" @click="onSubmit1">下一步</t-button>
        </t-col>
        <t-col :span="1" class="operation-container">
          <t-button variant="outline" @click="close">返回</t-button>
        </t-col>
      </t-row>
    </t-form>
    <t-form v-if="activeForm === 2" :key="activeForm" labelAlign="top"  ref="form" class="step-form" :data="formData2"  :rules="rules2"
            labelWidth="140px">
      <t-form-item label="（一）主要技术指标（如形成的新技术、新产品、新材料、专利、论文、专著等数量、指标及其水平等）：" name="technologyIndex">
        <tiny-mce-editor :key="activeForm" v-model="formData2.technologyIndex"></tiny-mce-editor>
      </t-form-item>
      <t-form-item label="（二）主要经济指标（如技术及产品应用所形成的市场规模、社会经济效益等）：" name="economicIndex">
        <tiny-mce-editor :key="activeForm" v-model="formData2.economicIndex"></tiny-mce-editor>
      </t-form-item>
      <t-form-item label="（三）项目实施中形成的示范基地、中试线、生产线及其规模等：" name="demonstrationBase">
        <tiny-mce-editor :key="activeForm" v-model="formData2.demonstrationBase"></tiny-mce-editor>
      </t-form-item>
      <t-form-item label="（四）提交的研究成果及形式：" name="projectExpectResults">
        <template slot="label">
          （四）提交的研究成果及形式  <span style="color: red">只能增加不能减少请认真填写！</span>
          <t-alert style="margin-bottom: 14px" theme="info">
            <div slot="message">
              <p class="span-txt">
                必须填写一条 成果类型为 研究报告的记录
              </p>
            </div>
          </t-alert>
        </template>
        <project-approach-expect-results :applyOpen="true" phaseType="3" :projectId="projectId" ref="project-approach-expect-results"
                                         v-model="formData2.projectExpectResults"
                                         :editOpen="true"></project-approach-expect-results>
<!--        <tiny-mce-editor :key="activeForm" v-model="formData2.researchResults"></tiny-mce-editor>-->
      </t-form-item>
      <t-form-item label="（五）成果转化方案：" name="resultsConversionScheme">
        <tiny-mce-editor :key="activeForm" v-model="formData2.resultsConversionScheme"></tiny-mce-editor>
      </t-form-item>
      <t-form-item label="（六）其他考核指标：" name="otherIndex">
        <tiny-mce-editor :key="activeForm" v-model="formData2.otherIndex"></tiny-mce-editor>
      </t-form-item>
      <t-row>
        <t-col :span="11" class="query-form-inline">
          <t-button @click="onCurChanged(1)" theme="primary" variant="base">上一步</t-button>
          <t-button theme="primary" @click="onSubmit2">下一步</t-button>
        </t-col>
        <t-col :span="1" class="operation-container">
          <t-button variant="outline" @click="close">返回</t-button>
        </t-col>
      </t-row>
    </t-form>
    <t-form v-if="activeForm === 3" :key="activeForm" labelAlign="top" ref="form" class="step-form" :data="formData3"  :rules="rules3"
            labelWidth="140px">
      <t-form-item label="项目研究的年度计划及年度目标" name="researchPlanData">
        <contract-year-plan ref="contract-year-plan" v-model="formData3.researchPlanData" :projectId="projectId" :contractId="contractId" :editOpen="true" phaseType="3"></contract-year-plan>
      </t-form-item>
      <t-row>
        <t-col :span="11" class="query-form-inline">
          <t-button @click="onCurChanged(2)" theme="primary" variant="base">上一步</t-button>
          <t-button theme="primary" @click="onSubmit3">下一步</t-button>
        </t-col>
        <t-col :span="1" class="operation-container">
          <t-button variant="outline" @click="close">返回</t-button>
        </t-col>
      </t-row>
    </t-form>
    <t-form v-if="activeForm === 4" :key="activeForm" labelAlign="top" ref="form" class="step-form" :data="formData4"  :rules="rules4"
            labelWidth="140px">
      <t-alert style="margin-bottom: 14px" theme="info" title="填写说明：">
        <div slot="message">
          <p class="span-txt">
            本项目科技成果及其形成的知识产权，其归属、管理和使用按照《交通运输行业知识产权管理办法》的有关规定执行。</p>
          <p class="span-txt">
            （其他约定）
          </p>
        </div>
      </t-alert>
      <t-form-item name="content" label="成果及其形成的知识产权的归属与保护：">
        <tiny-mce-editor :key="activeForm" v-model="formData4.content"></tiny-mce-editor>
      </t-form-item>
      <t-row>
        <t-col :span="11" class="query-form-inline">
          <t-button @click="onCurChanged(3)" theme="primary" variant="base">上一步</t-button>
          <t-button theme="primary" @click="onSubmit4">下一步</t-button>
        </t-col>
        <t-col :span="1" class="operation-container">
          <t-button variant="outline" @click="close">返回</t-button>
        </t-col>
      </t-row>
    </t-form>
    <t-form v-if="activeForm === 5" :key="activeForm" labelAlign="top" ref="form" class="step-form" :data="formData5" :rules="rules5"
            labelWidth="140px">
      <t-form-item name="unitList" label="承担单位、合作单位：">
        <project-unit ref="project-unit" :adviceFunding="adviceFunding" v-model="formData5.unitList" :projectId="projectId" :editOpen="true" phaseType="3"></project-unit>
      </t-form-item>
      <t-row>
        <t-col :span="11" class="query-form-inline">
          <t-button @click="onCurChanged(4)" theme="primary" variant="base">上一步</t-button>
          <t-button theme="primary" @click="onSubmit5">下一步</t-button>
        </t-col>
        <t-col :span="1" class="operation-container">
          <t-button variant="outline" @click="close">返回</t-button>
        </t-col>
      </t-row>
    </t-form>
    <t-form v-if="activeForm === 6" :key="activeForm" labelAlign="top" ref="form" class="step-form" :data="formData6"  :rules="rules6"
            labelWidth="140px">
      <t-form-item name="memberList" label="主要研究人员：">
        <project-member :isOldProject="isOldProject" v-model="formData6.memberList" :projectId="projectId" :editOpen="true" phaseType="3"></project-member>
      </t-form-item>
      <t-row>
        <t-col :span="11" class="query-form-inline">
          <t-button @click="onCurChanged(5)" theme="primary" variant="base">上一步</t-button>
          <t-button theme="primary" @click="onSubmit6">下一步</t-button>
        </t-col>
        <t-col :span="1" class="operation-container">
          <t-button variant="outline" @click="close">返回</t-button>
        </t-col>
      </t-row>
    </t-form>
    <t-form v-if="activeForm === 7" :key="activeForm" labelAlign="top" ref="form"  class="step-form" :data="formData7"
            labelWidth="0">
      <t-form-item >
        <project-budget v-model="formData7" :fundingObj="fundingObj" :projectId="projectId" :editOpen="true" phaseType="3"></project-budget>
      </t-form-item>
      <t-row>
        <t-col :span="11" class="query-form-inline">
          <t-button @click="onCurChanged(6)" theme="primary" variant="base">上一步</t-button>
          <t-button theme="primary" @click="onSubmit7">下一步</t-button>
        </t-col>
        <t-col :span="1" class="operation-container">
          <t-button variant="outline" @click="close">返回</t-button>
        </t-col>
      </t-row>
    </t-form>
    <t-form v-if="activeForm === 8" :key="activeForm" labelAlign="top" ref="form" :data="formData8" :rules="rules8" class="step-form"
            labelWidth="140px">
      <t-alert v-if="site_tag==='jtt'" style="margin-bottom: 14px" theme="info" title="填写说明：">
        <div slot="message">
          <p class="span-txt">
            任务书（合同）各方共同遵守《江西省交通运输厅科技项目管理办法》（以下简称《办法》）。</p>
          <p class="span-txt">1．项目承担方（乙方）必须按要求报告项目年度执行情况、下一年度经费预算和有关统计报表，逾期不报，委托方（甲方）有权暂停拨款。</p>
          <p class="span-txt">2．项目执行过程中，承担方（乙方）如需调整任务，应根据《办法》中有关规定，向委托方（甲方）提出变更内容及说明的申请报告，经委托方（甲方）审定批准后实施。未接到正式批准书以前，双方须按原任务书（合同）履行，否则后果由自行调整的一方负责。</p>
          <p class="span-txt">
            3．项目承担方（乙方）因某种原因（如与研究内容有出入、挪用经费、技术措施或实施条件不落实等）致使项目无法执行而要求中止任务，委托方（甲方）可根据调查结果中止研究任务。</p>
          <p class="span-txt">4．项目承担方（乙方）承担项目所需拨款按国家科技经费使用范围开支。</p>
          <p class="span-txt">5．委托方（甲方）根据科技经费的财务管理制度的规定，监督经费的使用情况。</p>
          <p class="span-txt">6．项目执行过程中，委托方（甲方）提出变更任务书（合同）有关内容时，要与承担方（乙方）协商达成书面协议。</p>
          <p class="span-txt">7．本任务书（合同）签订各方均负有相应的责任。若有争议或纠纷时，按科技项目有关管理办法有关条款处理。</p>
          <p class="span-txt">8．任务书（合同）正式文本委托方（甲方）和第一承担单位（乙方）各存两份、各承担单位和保证方各存一份。</p>
        </div>
      </t-alert>
      <t-alert v-else style="margin-bottom: 14px" theme="info" title="填写说明：">
        <div slot="message">
          <p class="span-txt">
            任务书（合同）各方共同遵守《江西省交通投资集团有限责任公司科技创新管理办法》（以下简称《办法》）。</p>
          <p class="span-txt">1．项目承担方（乙方）必须按要求报告项目年度执行情况、下一年度经费预算和有关统计报表，逾期不报，委托方（甲方）有权暂停拨款。</p>
          <p class="span-txt">2．项目执行过程中，承担方（乙方）如需调整任务，应根据《办法》中有关规定，向委托方（甲方）提出变更内容及说明的申请报告，经委托方（甲方）审定批准后实施。未接到正式批复以前，双方须按原任务书（合同）履行，否则后果由自行调整的一方负责。</p>
          <p class="span-txt">3. 项目承担方（乙方）因某种原因（如与研究内容有出入、挪用经费、技术措施或实施条件不落实等）致使项目无法执行而要求中止任务，委托方（甲方）可根据调查结果中止研究任务。</p>
          <p class="span-txt">4．项目承担方（乙方）承担项目所需拨款按国家科技经费使用范围开支。</p>
          <p class="span-txt">5．委托方（甲方）根据科技经费的财务管理制度的规定，监督经费的使用情况。</p>
          <p class="span-txt">6．项目执行过程中，委托方（甲方）提出变更任务书（合同）有关内容时，要与承担方（乙方）协商达成书面协议。</p>
          <p class="span-txt">7．本任务书（合同）签订各方均负有相应的责任。若有争议或纠纷时，按科技项目有关管理办法有关条款处理。</p>
          <p class="span-txt">8．任务书（合同）正式文本委托方（甲方）和第一承担单位（乙方）各存两份、各承担单位和保证方各存一份。</p>
        </div>
      </t-alert>
      <t-form-item name="terms"  label="（一）本任务书（合同）所协议的其它条款如下："  >
        <contract-terms ref="contract-terms" v-model="formData8.terms" :projectId="projectId" :contractId="contractId" :editOpen="true" phaseType="3"></contract-terms>
      </t-form-item>
      <t-row>
        <t-col :span="11" class="query-form-inline">
          <t-button @click="onCurChanged(7)" theme="primary" variant="base">上一步</t-button>
          <t-button theme="primary" @click="onSubmit8">下一步</t-button>
          <!--          <t-tooltip content="提交后不可再编辑会进入审批流程">-->
          <!--            <t-button theme="primary" @click="onSubmit8(2)">提交到单位管理员</t-button>-->
          <!--          </t-tooltip>-->
        </t-col>
        <t-col :span="1" class="operation-container">
          <t-button variant="outline" @click="close">返回</t-button>
        </t-col>
      </t-row>
    </t-form>
    <t-form v-if="activeForm === 9" :key="activeForm" labelAlign="top" ref="form" :data="formData9" :rules="rules9" class="step-form"
            labelWidth="140px">
      <t-row v-if="isOldProject === '0'" style="align-items: stretch" :gutter="14">
        <t-col :span="12">
          <t-form-item label="专家评审意见：" >
            <approve-list-by-review-type review-type="2" :obj-id="projectId"></approve-list-by-review-type>
          </t-form-item>
        </t-col>
      </t-row>
      <t-row style="align-items: stretch" :gutter="14">
        <t-col :span="12">
          <t-form-item label="（一）按专家评审意见修改说明：" name="content">
            <template #label>
              （一）按大纲专家评审意见修改说明：<span style="color: red">必须参照专家意见逐条回复</span>
            </template>
            <tiny-mce-editor :key="activeForm"
                             v-model="formData9.content"></tiny-mce-editor>
          </t-form-item>
        </t-col>
      </t-row>
      <t-row>
        <t-col :span="11" class="query-form-inline">
          <t-button @click="onCurChanged(8)" theme="primary" variant="base">上一步</t-button>
          <t-button theme="primary" @click="onSubmit9">下一步</t-button>
        </t-col>
        <t-col :span="1" class="operation-container">
          <t-button variant="outline" @click="close">返回</t-button>
        </t-col>
      </t-row>
    </t-form>
    <t-form v-if="activeForm === 10" :key="activeForm" labelAlign="top" ref="form" :data="formData10" :rules="rules10" class="step-form table-form"
            labelWidth="140px">
      <t-row>
        <t-col :span="2" class="title"><span class="require">*</span>任务书(合同)编号</t-col>
        <t-col :span="4">
          {{formData10?.project?.projectNum}}
        </t-col>
        <t-col :span="2" class="title">项目名称</t-col>
        <t-col :span="4">
          {{formData10?.contract?.projectName?formData10?.contract?.projectName:formData10?.project?.projectName}}
        </t-col>
      </t-row>
      <t-row>
        <t-col :span="2" class="title"><span class="require">*</span>密   级</t-col>
        <t-col :span="4">
          <t-form-item name="secretLevel">
            <t-radio-group :disabled="true" v-model="formData10.secretLevel" :options="dict.type.secret_level"></t-radio-group>
          </t-form-item>
        </t-col>
        <t-col :span="2" class="title">参加单位总数</t-col>
        <t-col :span="4">{{formData10.projectCompanyList.length}}个</t-col>
      </t-row>
      <t-row>
        <t-col :span="2" class="title" style="flex-direction: column">项目承担单位<span style="color:red;">可由单位管理员前往【工作台-系统管理-单位管理】调整</span></t-col>
        <t-col :span="10" style="display:block;">
          <t-row >
            <t-col :span="2" class="title">名    称</t-col>
            <t-col :span="10" >{{formData10?.assumeDept?.deptName}}</t-col>
          </t-row>
          <t-row >
            <t-col :span="2" class="title">单位所在地</t-col>
            <t-col :span="10" >
              {{ formData10.assumeDept.locationId | filterParentsByTree(locationOptions) }}
            </t-col>
          </t-row>
          <t-row>
            <t-col :span="2" class="title">通讯地址</t-col>
            <t-col :span="4">
              {{formData10?.assumeDept?.address}}
            </t-col>
            <t-col :span="2" class="title">邮编</t-col>
            <t-col :span="4">
              {{formData10?.assumeDept?.postCode}}
            </t-col>
          </t-row>
          <t-row>
            <t-col :span="2" class="title"><span class="require">*</span>单位性质</t-col>
            <t-col :span="10">
              <t-form-item name="assumeCompanyType">
                <t-radio-group v-model="formData10.assumeCompanyType" :options="dict.type.assume_company_type"></t-radio-group>
              </t-form-item>
            </t-col>
          </t-row>
          <t-row>
            <t-col :span="2" class="title">归口管理单位</t-col>
            <t-col :span="10">{{formData10.attributeDept.deptName}}</t-col>
          </t-row>
        </t-col>
      </t-row>
      <t-row>
        <t-col :span="2" class="title">合作或协作单位
        </t-col>
        <t-col :span="10" style="display:block;">
          <t-row>
            <t-col :span="1" class="title">序号</t-col>
            <t-col :span="11" class="title">单位名称</t-col>
          </t-row>
          <t-row v-for="(item,index) in formData10.projectCompanyList.filter(val=>{return val.type==='2'})" :key="index">
            <t-col :span="1"  style="justify-content: center">{{index+1}}</t-col>
            <t-col :span="11" >{{ item.name }}</t-col>
          </t-row>
        </t-col>
      </t-row>
      <t-row>
        <t-col :span="2" class="title">项目负责人
        </t-col>
        <t-col :span="10" style="display:block;">
          <t-row>
            <t-col :span="1" class="title">姓名</t-col>
            <t-col :span="3" >{{formData10.projectLeader.name}}</t-col>
            <t-col :span="1" class="title">性别</t-col>
            <t-col :span="3" >{{formData10.projectLeader.sex | filterByDict(dict.type.sys_user_sex)}}</t-col>
            <t-col :span="1" class="title">出生年月</t-col>
            <t-col :span="3" >{{formData10.projectLeader.birthDate}}</t-col>
          </t-row>
          <t-row>
            <t-col :span="1" class="title">学历</t-col>
            <t-col :span="11" >
              {{formData10.projectLeader.education  | filterByDict(dict.type.education) }}
            </t-col>
          </t-row>
          <t-row>
            <t-col :span="1" class="title">职称</t-col>
            <t-col :span="11" >
              {{formData10.projectLeader.profTit | filterByDict(dict.type.prof_tit)}}
            </t-col>
          </t-row>
          <t-row>
            <t-col :span="1" class="title">专业</t-col>
            <t-col :span="3" >
              {{formData10.projectLeader.majorNowName  }}
            </t-col>
            <t-col :span="1" class="title">联系电话</t-col>
            <t-col :span="3" >{{formData10.projectLeader.phone}}</t-col>
            <t-col :span="1" class="title">邮箱</t-col>
            <t-col :span="3" >{{formData10.projectLeader.email}}</t-col>
          </t-row>
        </t-col>
      </t-row>
      <t-row>
        <t-col :span="2" class="title">研究人员人数
        </t-col>
        <t-col :span="10" style="display:block;">
          共 {{formData10?.projectTeam?.totalCount}}   人。其中： 高级： {{formData10?.projectTeam?.highCount}}  人 中级： {{formData10?.projectTeam?.middleCount}} 人 初级： {{formData10?.projectTeam?.primaryCount}} 人 其他： {{formData10?.projectTeam?.auxilian}} 人
        </t-col>
      </t-row>
      <t-row>
        <t-col :span="2" class="title">起止时间
        </t-col>
        <t-col :span="10" style="display:block;">
          <t-row>
            <t-col :span="2" class="title">开始时间</t-col>
            <t-col :span="4" >{{formData10?.contract?.startDate?.substring(0,4)}} 年 {{formData10?.contract?.startDate?.substring(5,7)}} 月</t-col>
            <t-col :span="2" class="title">完成时间</t-col>
            <t-col :span="4" >{{formData10?.contract?.completeDate?.substring(0,4)}} 年 {{formData10?.contract?.completeDate?.substring(5,7)}} 月</t-col>
          </t-row>
        </t-col>
      </t-row>
      <t-row>
        <t-col :span="2" class="title">项目类型
        </t-col>
        <t-col :span="10" style="display:block;">
          <t-radio-group disabled v-model="formData10.project.projectType" :options="dict.type.project_type"></t-radio-group>
        </t-col>
      </t-row>
      <t-row>
        <t-col :span="2" class="title"><span class="require">*</span>所属技术领域
        </t-col>
        <t-col :span="10" style="display:block;">
          <t-form-item name="technosphere">
            <t-radio-group v-model="formData10.technosphere" :options="dict.type.technosphere"></t-radio-group>
          </t-form-item>
        </t-col>
      </t-row>
      <t-row>
        <t-col :span="2" class="title"><span class="require">*</span>项目技术来源
        </t-col>
        <t-col :span="10" style="display:block;">
          <t-form-item name="technologySource">
            <t-radio-group v-model="formData10.technologySource" :options="dict.type.technology_source"></t-radio-group>
          </t-form-item>
        </t-col>
      </t-row>
      <t-row>
        <t-col :span="2" class="title"><span class="require">*</span>主要研究内容(100字以内)
        </t-col>
        <t-col :span="10" style="display:block;">
          <t-form-item name="mainContent">
          <t-textarea
            v-model="formData10.mainContent"
            clearable :maxlength="100" :autosize="{minRows: 5}"

            placeholder="请输入内容"
          />
          </t-form-item>
        </t-col>
      </t-row>
      <t-row>
        <t-col :span="2" class="title"><span class="require">*</span>预期成果形式
        </t-col>
        <t-col :span="10" style="display:block;">
          <t-form-item name="expectResultList">
            <t-checkbox-group v-model="formData10.expectResultList" :options="dict.type.expect_result"></t-checkbox-group>
          </t-form-item>
        </t-col>
      </t-row>
      <t-row>
        <t-col :span="2" class="title"><span class="require">*</span>预期取得专利
        </t-col>
        <t-col :span="10" style="display:block;">
          <t-form-item name="expectPatent">
            <t-radio-group v-model="formData10.expectPatent" :options="dict.type.expect_patent"></t-radio-group>
          </t-form-item>
        </t-col>
      </t-row>
      <t-row>
        <t-col :span="2" class="title">经费投入
        </t-col>
        <t-col :span="10" style="display:block;">
          <t-row>
            <t-col :span="2" class="title">总经费</t-col>
            <t-col :span="4" >{{fundingObj.adviceFunding}}万元</t-col>
            <t-col :span="2" class="title">{{site_tag==='jtt'?'厅拨经费':'集团补助经费'}}</t-col>
            <t-col :span="4" >{{fundingObj.subsidyFunding}}万元</t-col>
          </t-row>
        </t-col>
      </t-row>
      <t-row style="margin-top: 24px">
        <t-col style="border: 0;margin: 0px;padding: 0px !important" :span="11" class="query-form-inline">
          <t-button @click="onCurChanged(9)" theme="primary" variant="base">上一步</t-button>
          <t-button v-if="isOldProject !== '1'" theme="primary"  @click="onSubmit10(1)">暂存</t-button>
            <t-tooltip v-if="isOldProject !== '1'" content="提交后不可再编辑会进入审批流程">
              <t-button :disabled="isCommit" theme="primary" @click="onSubmit10(2)" >提交到单位管理员</t-button>
            </t-tooltip>
          <t-button v-if="isOldProject === '1'" theme="primary" @click="onSubmit10(2)">下一步</t-button>
        </t-col>
        <t-col style="border: 0;margin: 0px;padding: 0px !important" :span="1" class="operation-container">
          <t-button variant="outline" @click="close">返回</t-button>
        </t-col>
      </t-row>
    </t-form>
    <!-- 附件信息 -->
    <div class="step-form" v-if="activeForm === 11">
      <t-row>
        <t-col :span="12">
          <t-table row-key="id" :columns="projectFileColumns" :data="projectFileData">
            <template #id="{row, rowIndex}">
              {{ rowIndex+1 }}
            </template>
            <template #op="{row}">
              <file-upload  tips="限制pdf、图片" accept="application/pdf,image/*" v-model="row.fileIds" :moduleKey="row.moduleKey"
                            :fileList="row.fileLists"
                            :multiple="true">
                <t-button variant="outline">
                  <t-icon name="cloud-upload" slot="icon"/>
                  点击上传
                </t-button>
              </file-upload>
            </template>
            <template #c1="{row}">
              <a v-if="row.c3" class="t-button-link" :href="`${file_domain}/${row.c3}`" target="_blank">{{ row.c1 }}</a>
              <div v-else>{{ row.c1 }}</div>
            </template>
          </t-table>
        </t-col>
      </t-row>
      <t-row>
        <t-col :span="11" class="query-form-inline">
          <t-button  type="reset" @click="onCurChanged(10)" theme="primary" variant="base">上一步
          </t-button>
          <t-tooltip content="提交后不会进入审批流程">
          <t-button  theme="primary" :loading="loading" @click="onSubmit11">{{ loading?'提交中': '提交' }}</t-button>
          </t-tooltip>
        </t-col>
        <t-col :span="1" class="operation-container">
          <t-button variant="outline" @click="close">返回</t-button>
        </t-col>
      </t-row>
    </div>
    <outline-detail-dialog :header="dialog.header" :objId="projectId" :visible.sync="dialog.open_outline_detail" v-if="dialog.open_outline_detail"></outline-detail-dialog>

  </div>
</template>

<script>
import { VITE_FILE_DOMAIN } from '@/api/upload'
import TinyMceEditor from "@/components/TinyMceEditor/index.vue";

import ProjectBudget from '../pm/components/project-budget.vue'
import ContractYearPlan from './components/contract-year-plan.vue'
import ContractTerms from './components/contract-terms.vue'

import ProjectMember from '../pm/components/project-member.vue'
import ProjectUnit from '../pm/components/project-unit.vue'
import OutlineDetailDialog from "../outline/components/outline-detail-dialog.vue";
import dayjs from "dayjs";
import FileUpload from "@/components/FileUpload/index.vue"
import {getFiles} from "@/api/common";
import ApproveList from "../approve/components/approve-list.vue";
import ApproveListByReviewType from "../approve/components/approve-list-by-review-type.vue";
import ProjectApproachExpectResults from "../pm/components/project-approach-expectResults.vue";

export default {
  name: "project-contract",
  dicts: ["secret_level", "assume_company_type", "sys_user_sex", "expect_patent", "technology_source", "technosphere",
    "expect_result", "project_type", "subject_classification", "prof_tit", "degree", "duty", "platform_type", "education"],
  components:{
    TinyMceEditor,
    ProjectUnit,
    ProjectBudget,
    ContractYearPlan,
    ProjectMember,
    ContractTerms,
    OutlineDetailDialog,
    FileUpload,
    ApproveList,
    ApproveListByReviewType,
    ProjectApproachExpectResults
  },
  data(){
    return {
      loading: false,
      site_tag: import.meta.env.VITE_SITE_TAG,
      file_domain: VITE_FILE_DOMAIN,
      projectData: {},
      fundingObj: {subsidyFunding: 0, adviceFunding: 0},
      adviceFunding: 0,
      disableDate: {},
      applyLoading: false,
      dialog:{
        header: '',
        objId: null,
        open_outline_detail: false,
        open_approve_list: false,
      },
      isCommit: false,
      projectId:null,
      taskId: null,
      contractId: null,
      dictTypes:{},
      activeForm: null,
      projectObj:{
        projectLeader:{
          name:''
        }
      },
      formData0:{
        contractNum: '',
        startDate: '',
        completeDate: '',
        adviceFunding: null,
        subsidyFunding: null,
        projectName: '',
        // contractStatus: '1'
      },
      rules0:{
        contractNum:[
          {
            required: true,
            message: "任务书(合同)编号不能为空",
          },
        ],
        startDate: [
          {
            required: true,
            message: "任务书开始时间不能为空",
          },
        ],
        completeDate: [
          {
            required: true,
            message: "任务书结束时间不能为空",
          },
          {
            validator: (val) => {
              if(val && this.formData0.startDate){
                const startTime = new Date(this.formData0.startDate).getTime()
                const endTime = new Date(val).getTime()
                return startTime <= endTime;
              }
              return true;
            }, message: "任务书开始时间不能大于结束时间", type: "error"
          },
        ],
        adviceFunding: [
          {
            required: true,
            message: "建议经费总概算不能为空",
          },
        ],
        subsidyFunding: [
          {
            required: true,
            message: "申请补助经费不能为空",
          },
        ],
      },
      formData1:{
        goal:'',
        content:'',
        dependingSituation: ''
      },
      rules1:{
        goal: [
          {
            required: true,
            message: "项目研究的主要目的不能为空",
          },
        ],
        content: [
          {
            required: true,
            message: "主要研究内容不能为空",
          },
        ],
        dependingSituation: [
          {
            required: true,
            message: "本项目的依托工程应用情况不能为空",
          },
        ],
      },
      formData2:{
        technologyIndex: '',
        economicIndex: '',
        demonstrationBase: '',
        researchResults: '',
        resultsConversionScheme: '',
        otherIndex: '',
        projectExpectResults: []
      },
      rules2:{
        technologyIndex: [
          {
            required: true,
            message: "主要技术指标不能为空",
          },
        ],
        economicIndex: [
          {
            required: true,
            message: "主要经济指标不能为空",
          },
        ],
        demonstrationBase: [
          {
            required: true,
            message: "项目实施中形成的示范基地、中试线、生产线及其规模等不能为空",
          },
        ],
        researchResults: [
          {
            required: true,
            message: "提交的研究成果及形式不能为空",
          },
        ],
        resultsConversionScheme: [
          {
            required: true,
            message: "成果转化方案不能为空",
          },
        ],
        otherIndex: [
          {
            required: true,
            message: "其他考核指标不能为空",
          },
        ],
        projectExpectResults: [
          {required: true, validator: (val) => val.length > 0, message: "预期研究成果及表达形式不能为空", type: "error"}
        ],
      },
      formData3:{
        researchPlanData:[],
      },
      rules3:{
        researchPlanData:[
          {required: true, validator: (val) => val && val.length, message: "项目研究的年度计划及年度目标不能为空", type: "error"}
        ],
      },
      formData4:{
        content: ''
      },
      rules4:{
        content:[
          {
            required: true,
            message: "成果及其形成的知识产权的归属与保护不能为空",
          },
        ]
      },
      formData5:{
        unitList:[],
      },
      rules5:{
        unitList:[
          {required: true, validator: (val) => val && val.length, message: "承担单位、合作单位不能为空", type: "error"}
        ],
      },
      formData6:{
        memberList:[]
      },
      rules6:{
        memberList:[
          {required: true, validator: (val) => val && val.length, message: "研究人员", type: "error"}
        ],
      },
      formData7:{
        phaseType: '3',
        inTbBudget: null,
        inZcBudget: null,
        inZcQtczbkBudget: null,
        inZcDwBudget: null,
        inZcQtBudget: null,
        outTbSbBudget: null,
        outZcSbBudget: null,
        outTbSzsbBudget: null,
        outZcSzsbBudget: null,
        outTbSbzzBudget: null,
        outZcSbzzBudget: null,
        outTbClBudget: null,
        outZcClBudget: null,
        outTbSyjgBudget: null,
        outZcSyjgBudget: null,
        outTbRldlBudget: null,
        outZcRldlBudget: null,
        outTbClvBudget: null,
        outZcClvBudget: null,
        outTbHyBudget: null,
        outTbGjhzBudget: null,
        outZcGjhzBudget: null,
        outTbCbBudget: null,
        outZcCbBudget: null,
        outTbLwBudget: null,
        outZcLwBudget: null,
        outTbZjzxBudget: null,
        outZcZjzxBudget: null,
        outTbQtBudget: null,
        outZcQtBudget: null,
        outTbGlBudget: null,
        outZcGlBudget: null,
        outTbJxzcBudget: null,
        outZcJxzcBudget: null,
        outZcHyBudget: null
      },
      formData8:{
        terms:[]
      },
      rules8:{

      },
      formData9:{
        projectId: null,
        contractId: null,
        content: '',
      },
      rules9:{
        content: [
          {
            required: true,
            message: "按专家评审意见修改说明不能为空",
          },
        ],
      },
      formData10:{
        secretLevel:'4',
        assumeCompanyType: '',
        technosphere: '',
        technologySource: '',
        mainContent: '',
        expectResult: '',
        expectPatent: '',
        expectResultList: [],
        isSubmit: '',
        projectCompanyList: [],
        projectLeader:{},
        attributeDept:{},
        project: {},
        assumeDept: {}
      },
      rules10:{
        'contract.contractNum':[
          {
            required: true,
            message: "任务书(合同)编号不能为空",
          }
        ],
        secretLevel: [
          {
            required: true,
            message: "其他考核指标不能为空",
          }
        ],
        assumeCompanyType: [
          {
            required: true,
            message: "单位性质不能为空",
          }
        ],
        technosphere: [
          {
            required: true,
            message: "所属技术领域不能为空",
          }
        ],
        technologySource: [
          {
            required: true,
            message: "项目技术来源不能为空",
          }
        ],
        mainContent: [
          {
            required: true,
            message: "主要研究内容不能为空",
          }
        ],
        // expectResult: [
        //   {
        //     required: true,
        //     message: "预期成果形式不能为空",
        //   }
        // ],
        expectResultList: [
          {
            required: true,
            validator: (val) => val && val.length,
            message: "预期成果形式不能为空",
          }
        ],
        expectPatent: [
          {
            required: true,
            message: "预期取得专利不能为空",
          }
        ],
      },
      projectFileData: [
        {
          id: 1,
          c1: "已盖章任务书",
          c2: "审批通过之后，走完盖章流程后上传。",
          fileIds: [],
          fileLists: [],
          moduleKey: "projectRWS"
        },
        {
          id: 2,
          c1: "其他附件",
          c2: "审批通过之后，走完盖章流程后上传。",
          fileIds: [],
          fileLists: [],
          moduleKey: "projectRWSQT"
        }
      ],
      projectFileColumns: [
        {
          colKey: "id",
          title: "序号",
          align: "center",
          width: 64
        },
        {
          colKey: "c1",
          title: "附件名称",
          align: "center",
        },

        {
          colKey: "c2",
          title: "是否必需",
          align: "center",
        },
        {
          colKey: "op",
          title: "操作",
          align: "left",
        },
      ],
      isOldProject: '0',
      locationOptions: [],
    }
  },
  watch: {
    activeForm: {
      immediate: true,
      handler(val) {
        const targetEle = document.getElementById("main")
        if (targetEle) {
          const {pos, top} = targetEle.style;
          targetEle.style.position = 'relative';
          targetEle.style.top = '-100px';
          targetEle.scrollIntoView({behavior: 'smooth', block: 'start', inline: "nearest"});
          targetEle.style.top = top;
          targetEle.style.position = pos;
        }
      }
    }
  },
  async created() {
    this.isOldProject = this.$route.query.isOldProject || '0';
    await  Promise.all([this.getLocationTree()])
    const projectId = this.$route.params && this.$route.params.taskId;
    if (!projectId) {
      this.$message.error("缺少项目id");
      return false;
    }
    this.projectId = projectId;
    this.dialog.objId = projectId;
    this.taskId = projectId;
    const activeForm = Number(sessionStorage.getItem(`${this.taskId}-contract-activeForm`)) || 0;
    // 获取项目详情
    this.applyLoading = true;
    Promise.all([this.$api.kjxm.project.get(Number(this.projectId)),this.$api.kjxm.outline.getByProject(Number(this.projectId))]).then(response => {
      this.disableDate = {
        before: dayjs(response[0].data.startDate, "YYYY-MM-DD").endOf('month').subtract(1, 'month').format(),
        after: dayjs(response[0].data.endDate, "YYYY-MM-DD").endOf('month').subtract(0, 'month').format(),
      }
      this.fundingObj = {
        adviceFunding: response[1].data.adviceFunding,
        subsidyFunding: response[1].data.subsidyFunding
      }
      this.adviceFunding = response[1].data.adviceFunding;
      this.formData0.adviceFunding = response[1].data.adviceFunding;
      this.formData0.subsidyFunding = response[1].data.subsidyFunding;
      this.formData0.projectName = response[1].data.projectName;
      this.projectData = response[0].data;
      this.onCurChanged(activeForm, 0);
    }).catch((e) => {
      this.applyLoading = false;
      this.$message.error(e.toString());
    });
  },
  methods:{
    handlerOpenDetail(val){
      if(val.item.label==='大纲详情'){
        this.dialog.open_outline_detail = true;
      }else if(val.item.label === '大纲评审记录'){
        this.dialog.open_approve_list = true;
      }
    },
    getLocationTree(){
      return  this.$api.system.location.treeselect().then(response => {
        this.locationOptions = response.data;
      }).catch((e) => {
        this.$message.error(e.toString());
      });
    },
    isSubmitStatus(name) {
      return !!sessionStorage.getItem(`${this.taskId}-contract-${name}`);
    },
    isSubmit(name) {
      if(sessionStorage.getItem(`${this.taskId}-contract-${name}`)){
        return '已提交'
      }
      return '未提交';
    },
    onCurChanged(cur, pre){
      if(Number(cur) !== 0){
        if (!sessionStorage.getItem(`${this.taskId}-contract-contractId`)) {
          this.applyLoading = false;
          this.$message.error("基本信息还未提交")
          return false;
        }
      }
      this.applyLoading = true;
      // 根据不同的activeForm 复查数据
      if (Number(cur) === 0) {
        if (sessionStorage.getItem(`${this.taskId}-contractId`)) {
          const contractId = Number(sessionStorage.getItem(`${this.taskId}-contractId`));
          this.$api.kjxm.contract.get(contractId).then(response => {
            if (response.data) {
              // 为null剔除 使用项目的
              if (response.data.subsidyFunding === null) {
                delete response.data.subsidyFunding;
              }
              if (response.data.adviceFunding === null) {
                delete response.data.adviceFunding;
              }
              if ([null,''].includes(response.data.projectName)) {
                delete response.data.projectName;
              }
              Object.assign(this.formData0, response.data)
              Object.assign(this.fundingObj, response.data)
            }
            this.activeForm = cur;
            sessionStorage.setItem(`${this.taskId}-contract-activeForm`, cur);
            this.applyLoading = false;
          }).catch((e) => {
            this.applyLoading = false;
            this.$message.error(e.toString());
          });
        } else {
          this.activeForm = cur;
          sessionStorage.setItem(`${this.taskId}-contract-activeForm`, cur);
          this.applyLoading = false;
        }
      } else if (Number(cur) === 1) {
        const contractId = Number(sessionStorage.getItem(`${this.taskId}-contractId`));
        this.$api.kjxm.contract.purposeContentGet(contractId).then(response => {
          if (response.data) {
            Object.assign(this.formData1, response.data)
          }
          this.activeForm = cur;
          sessionStorage.setItem(`${this.taskId}-contract-activeForm`, cur);
          this.applyLoading = false;
        }).catch((e) => {
          this.applyLoading = false;
          this.$message.error(e.toString());
        });
      } else if (Number(cur) === 2) {
        const contractId = Number(sessionStorage.getItem(`${this.taskId}-contractId`));
        this.$api.kjxm.contract.assessIndexGet(contractId).then(response => {
          if (response.data) {
            Object.assign(this.formData2, response.data)
          }
          this.activeForm = cur;
          sessionStorage.setItem(`${this.taskId}-contract-activeForm`, cur);
          this.applyLoading = false;
        }).catch((e) => {
          this.applyLoading = false;
          this.$message.error(e.toString());
        });
      } else if (Number(cur) === 3) {
        this.activeForm = cur;
        sessionStorage.setItem(`${this.taskId}-contract-activeForm`, cur);
        this.applyLoading = false;
      } else if (Number(cur) === 4) {
        const contractId = Number(sessionStorage.getItem(`${this.taskId}-contractId`));
        this.$api.kjxm.contract.ResultsGetByContractId(contractId).then(response => {
          if (response.data) {
            Object.assign(this.formData4, response.data)
          }
          this.activeForm = cur;
          sessionStorage.setItem(`${this.taskId}-contract-activeForm`, cur);
          this.applyLoading = false;
        }).catch((e) => {
          this.applyLoading = false;
          this.$message.error(e.toString());
        });
      } else if (Number(cur) === 5) {
        const contractId = Number(sessionStorage.getItem(`${this.taskId}-contractId`));
        this.$api.kjxm.contract.get(contractId).then(response => {
          if (response.data) {
            if (response.data.adviceFunding === null) {
              delete response.data.adviceFunding;
            }else {
              this.adviceFunding = response.data.adviceFunding;
            }
          }
          this.activeForm = cur;
          sessionStorage.setItem(`${this.taskId}-contract-activeForm`, cur);
          this.applyLoading = false;
        }).catch((e) => {
          this.applyLoading = false;
          this.$message.error(e.toString());
        });
      } else if (Number(cur) === 6) {
        this.activeForm = cur;
        sessionStorage.setItem(`${this.taskId}-contract-activeForm`, cur);
        this.applyLoading = false;
      } else if (Number(cur) === 7) {
        const contractId = Number(sessionStorage.getItem(`${this.taskId}-contractId`));
        this.$api.kjxm.contract.get(contractId).then(response => {
          if (response.data) {
            // 为null剔除 使用项目的
            if (response.data.subsidyFunding === null) {
              delete response.data.subsidyFunding;
            }
            if (response.data.adviceFunding === null) {
              delete response.data.adviceFunding;
            }
            Object.assign(this.fundingObj, response.data)
          }
          this.activeForm = cur;
          sessionStorage.setItem(`${this.taskId}-contract-activeForm`, cur);
          this.applyLoading = false;
        }).catch((e) => {
          this.applyLoading = false;
          this.$message.error(e.toString());
        });
        // this.activeForm = cur;
        // sessionStorage.setItem(`${this.taskId}-contract-activeForm`, cur);
        // this.applyLoading = false;
      } else if (Number(cur) === 8) {
        const contractId = Number(sessionStorage.getItem(`${this.taskId}-contractId`));
        this.$api.kjxm.contract.termsGetByContractId(contractId).then(response => {
          this.formData8.terms = response.data;
          this.activeForm = cur;
          sessionStorage.setItem(`${this.taskId}-contract-activeForm`, cur);
          this.applyLoading = false;
        }).catch((e) => {
          this.applyLoading = false;
          this.$message.error(e.toString());
        });
      }
      else if (Number(cur) === 9) {
        const contractId = Number(sessionStorage.getItem(`${this.taskId}-contractId`));
        this.$api.kjxm.contract.projectContractExplainGetByContractId(contractId).then(response => {
          if (response.data) {
            Object.assign(this.formData9, response.data)
          }
          this.activeForm = cur;
          sessionStorage.setItem(`${this.taskId}-contract-activeForm`, cur);
          this.applyLoading = false;
        }).catch((e) => {
          this.applyLoading = false;
          this.$message.error(e.toString());
        });
      }
      else if (Number(cur) === 10) {
        const contractId = Number(sessionStorage.getItem(`${this.taskId}-contractId`));
        Promise.all([this.$api.kjxm.contract.contractOthersGetByContractId(contractId),this.$api.kjxm.contract.get(contractId)]).then(response => {
          if(response[0].data){
            Object.assign(this.formData10, response[0].data)
            this.formData10.expectResultList = this.formData10?.expectResult?.split(",").filter(item=> item !== '') || [];
            // 默认公开
            this.formData10.secretLevel = response[0].data.secretLevel || '4';
          }
          if (response[1].data) {
            // 为null剔除 使用项目的
            if (response[1].data.subsidyFunding === null) {
              delete response[1].data.subsidyFunding;
            }
            if (response[1].data.adviceFunding === null) {
              delete response[1].data.adviceFunding;
            }
            Object.assign(this.fundingObj, response[1].data)
          }
          this.activeForm = cur;
          sessionStorage.setItem(`${this.taskId}-contract-activeForm`, cur);
          this.applyLoading = false;
        }).catch((e) => {
          this.applyLoading = false;
          this.$message.error(e.toString());
        });

      }else if (Number(cur) === 11) {
        getFiles(this.taskId).then((res) => {
          const files = {}
          res.data.forEach((item) => {
            if (!files[item.moduleKey]) {
              files[item.moduleKey] = []
            }
            files[item.moduleKey].push({
              name: item.fileName,
              url: item.fullFilePath,
              id: item.id,
              filePath: item.filePath
            })
          })
          const fileLists = []
          this.projectFileData.forEach((val,index)=>{
            this.projectFileData[index].fileLists = files[val.moduleKey] || [];
            this.projectFileData[index].fileIds = files[val.moduleKey]?.map(val => val.id) || [];
            fileLists.push(...this.projectFileData[index].fileIds)
          })
          if (fileLists.length > 0) {
            sessionStorage.setItem(`${this.taskId}-contract-fileId`, res.data.length)
          }
          // this.projectFileData[0].fileLists = files.projectRWS || [];
          // this.projectFileData[0].fileIds = files.projectRWS?.map(val => val.id) || [];
          this.activeForm = cur;
          sessionStorage.setItem(`${this.taskId}-contract-activeForm`, cur);
          this.applyLoading = false;
        }).catch((e) => {
          this.applyLoading = false;
          this.$message.error(e.toString());
        });
      }
    },
    onSubmit0() {
      this.$refs.form.validate().then((validateResult) => {
        if (validateResult === true) {
          if (Number(this.formData0.adviceFunding) < Number(this.formData0.subsidyFunding)) {
            const label = this.site_tag === 'jtt' ? '申请厅补助经费' : '申请集团补助经费';
            this.$message.error(`建议经费总概算:${this.formData0.adviceFunding}不能小于${label}:${this.formData0.subsidyFunding}`);
            return false
          }
          this.applyLoading = true;
          if (!sessionStorage.getItem(`${this.taskId}-contract-contractId`)) {
            this.$api.kjxm.contract.add({
              ...this.formData0,
              // contractStatus: this.isOldProject === '1'?null:'1',
              projectId: this.projectId,
            }).then(response => {
              sessionStorage.setItem(`${this.taskId}-contractId`, response.data.id)
              sessionStorage.setItem(`${this.taskId}-contract-contractId`, response.data.id)
              this.$message.success("提交成功");
              this.onCurChanged(1)
            }).catch((e) => {
              this.applyLoading = false;
              this.$message.error(e.toString());
            });
          } else {
            this.$api.kjxm.contract.update({
              ...this.formData0,
              // contractStatus: this.isOldProject === '1'?null:'1',
              id: Number(sessionStorage.getItem(`${this.taskId}-contract-contractId`)),
              projectId: this.projectId,
            }).then(response => {
              this.$message.success("提交成功");
              this.onCurChanged(1);
            }).catch((e) => {
              this.applyLoading = false;
              this.$message.error(e.toString());
            });
          }
        }
        else{
          const firstError = Object.values(validateResult)[0]?.[0]?.message;
          this.$message.error(firstError);
        }
      });
    },
    onSubmit1() {
      this.$refs.form.validate().then((validateResult) => {
        if (validateResult === true) {
          this.applyLoading = true;
          if (!sessionStorage.getItem(`${this.taskId}-contract-purposeContentId`)) {
            this.$api.kjxm.contract.purposeContentAdd({
              ...this.formData1,
              contractId:Number(sessionStorage.getItem(`${this.taskId}-contractId`)),
              projectId:this.projectId,
            }).then(response => {
              sessionStorage.setItem(`${this.projectId}-contract-purposeContentId`, response.data.id)
              this.$message.success('提交成功');
              this.onCurChanged(2)
            }).catch((e) => {
              this.applyLoading = false;
              this.$message.error(e.toString());
            });
          } else {
            this.$api.kjxm.contract.purposeContentUpdate({
              ...this.formData1,
              id: Number(sessionStorage.getItem(`${this.taskId}-contract-purposeContentId`)),
              contractId:Number(sessionStorage.getItem(`${this.taskId}-contractId`)),
              projectId:this.projectId,
            }).then(response => {
              this.$message.success('提交成功');
              this.onCurChanged(2)
            }).catch((e) => {
              this.applyLoading = false;
              this.$message.error(e.toString());
            });
          }
        } else{
          const firstError = Object.values(validateResult)[0]?.[0]?.message;
          this.$message.error(firstError);
        }
      });
    },
    onSubmit2(){
      this.$refs.form.validate().then((validateResult) => {
        if (validateResult === true) {
          this.applyLoading = true;
          if (!sessionStorage.getItem(`${this.taskId}-contract-assessIndexId`)) {
            this.$api.kjxm.contract.assessIndexAdd({
              ...this.formData2,
              contractId:Number(sessionStorage.getItem(`${this.taskId}-contractId`)),
              projectId:Number(this.projectId),
            }).then(response => {
              sessionStorage.setItem(`${this.taskId}-contract-assessIndexId`, response.data.id)
              this.$message.success('提交成功');
              this.onCurChanged(3)
            }).catch((e) => {
              this.applyLoading = false;
              this.$message.error(e.toString());
            });
          } else {
            this.$api.kjxm.contract.assessIndexUpdate({
              ...this.formData2,
              id: Number(sessionStorage.getItem(`${this.taskId}-contract-assessIndexId`)),
              contractId:Number(sessionStorage.getItem(`${this.taskId}-contractId`)),
              projectId:Number(this.projectId),
            }).then(response => {
              this.$message.success('提交成功');
              this.onCurChanged(3)
            }).catch((e) => {
              this.applyLoading = false;
              this.$message.error(e.toString());
            });
          }
        } else{
          const firstError = Object.values(validateResult)[0]?.[0]?.message;
          this.$message.error(firstError);
        }
      })
    },
    onSubmit3(){
      const isValidate = this.$refs["contract-year-plan"].checkData()
      if (!isValidate) {
        return false;
      }
      this.applyLoading = true;
      this.formData3.researchPlanData = this.formData3.researchPlanData.map(val => ({...val, contractId: Number(sessionStorage.getItem(`${this.taskId}-contractId`))}))
      this.$api.kjxm.contract.researchPlanAdd(this.formData3.researchPlanData).then(response => {
        this.$message.success('提交成功');
        sessionStorage.setItem(`${this.taskId}-contract-researchPlanId`, this.formData3.researchPlanData.length);
        this.onCurChanged(4);
      }).catch((e) => {
        this.applyLoading = false;
        this.$message.error(e.toString());
      });
    },
    onSubmit4(){
      this.applyLoading = true;
      if (!sessionStorage.getItem(`${this.taskId}-contract-resultsId`)) {
        this.$api.kjxm.contract.ResultsAdd({
          ...this.formData4,
          contractId:Number(sessionStorage.getItem(`${this.taskId}-contractId`)),
          projectId:this.projectId,
        }).then(response => {
          sessionStorage.setItem(`${this.taskId}-contract-resultsId`, response.data.id)
          this.$message.success('提交成功');
          this.onCurChanged(5)
        }).catch((e) => {
          this.applyLoading = false;
          this.$message.error(e.toString());
        });
      } else {
        this.$api.kjxm.contract.ResultsUpdate({
          ...this.formData4,
          id: sessionStorage.getItem(`${this.taskId}-contract-resultsId`),
          contractId:Number(sessionStorage.getItem(`${this.taskId}-contractId`)),
          projectId:this.projectId,
        }).then(response => {
          this.$message.success('提交成功');
          this.onCurChanged(5)
        }).catch((e) => {
          this.applyLoading = false;
          this.$message.error(e.toString());
        });
      }
    },
    onSubmit5(){
      const isValidate = this.$refs["project-unit"].checkData()
      if (!isValidate) {
        return false;
      }
      this.applyLoading = true;
      this.formData5.unitList = this.formData5.unitList.map(val => ({...val}))
      this.$api.kjxm.project.companyAdd(this.formData5.unitList).then(response => {
        this.$message.success('提交成功');
        sessionStorage.setItem(`${this.taskId}-contract-companyId`, this.formData5.unitList.length)
        this.onCurChanged(6)
      }).catch((e) => {
        this.applyLoading = false;
        this.$message.error(e.toString());
      });
    },
    onSubmit6(){
      // 需要判断必填
      const data1 = this.formData6.memberList.filter((val) => ['1', '2'].includes(val.type));
      const data2 = this.formData6.memberList.filter((val) => val.type === '3');
      if (data1.length <= 0) {
        this.$message.error('项目负责人不能为空');
        return
      }
      this.formData6.memberList = this.formData6.memberList.map(val => ({...val}))

      this.applyLoading = true;
      this.$api.kjxm.project.memberAdd(this.formData6.memberList).then(response => {
        this.$message.success('提交成功');
        sessionStorage.setItem(`${this.taskId}-contract-memberId`, this.formData6.memberList.length)
        this.onCurChanged(7)
      }).catch((e) => {
        this.applyLoading = false;
        this.$message.error(e.toString());
      });
    },
    onSubmit7(){
      this.$refs.form.validate().then((validateResult) => {
        if (validateResult === true) {
          // 判断经费来源 经费支出 是否一致
          const sum1 = (Number(((this.formData7.inTbBudget || 0)*100).toFixed(2)) + Number(((this.formData7.inZcBudget || 0)*100).toFixed(2))) / 100;
          const sum2 = (Number(((this.formData7.outTbSbBudget || 0)*100).toFixed(2)) + Number(((this.formData7.outTbSzsbBudget || 0)*100).toFixed(2)) + Number(((this.formData7.outTbSbzzBudget || 0)*100).toFixed(2)) + Number(((this.formData7.outTbClBudget || 0)*100).toFixed(2)) + Number(((this.formData7.outTbSyjgBudget || 0)*100).toFixed(2)) + Number(((this.formData7.outTbRldlBudget || 0)*100).toFixed(2)) + Number(((this.formData7.outTbClvBudget || 0)*100).toFixed(2)) + Number(((this.formData7.outTbHyBudget || 0)*100).toFixed(2)) + Number(((this.formData7.outTbGjhzBudget || 0)*100).toFixed(2)) + Number(((this.formData7.outTbCbBudget || 0)*100).toFixed(2)) + Number(((this.formData7.outTbLwBudget || 0)*100).toFixed(2)) + Number(((this.formData7.outTbZjzxBudget || 0)*100).toFixed(2)) + Number(((this.formData7.outTbQtBudget || 0)*100).toFixed(2)) + Number(((this.formData7.outTbGlBudget || 0)*100).toFixed(2))  + Number(((this.formData7.outTbJxzcBudget || 0)*100).toFixed(2)) + Number(((this.formData7.outZcSbBudget || 0)*100).toFixed(2)) + Number(((this.formData7.outZcSzsbBudget || 0)*100).toFixed(2)) + Number(((this.formData7.outZcSbzzBudget || 0)*100).toFixed(2)) + Number(((this.formData7.outZcClBudget || 0)*100).toFixed(2)) + Number(((this.formData7.outZcSyjgBudget || 0)*100).toFixed(2)) + Number(((this.formData7.outZcRldlBudget || 0)*100).toFixed(2)) + Number(((this.formData7.outZcClvBudget || 0)*100).toFixed(2)) + Number(((this.formData7.outZcHyBudget || 0)*100).toFixed(2)) + Number(((this.formData7.outZcGjhzBudget || 0)*100).toFixed(2)) + Number(((this.formData7.outZcCbBudget || 0)*100).toFixed(2)) + Number(((this.formData7.outZcLwBudget || 0)*100).toFixed(2)) + Number(((this.formData7.outZcZjzxBudget || 0)*100).toFixed(2)) + Number(((this.formData7.outZcQtBudget || 0)*100).toFixed(2)) + Number(((this.formData7.outZcGlBudget || 0)*100).toFixed(2)) + Number(((this.formData7.outZcJxzcBudget || 0)*100).toFixed(2))) / 100;
          if (sum1 !== sum2) {
            this.$message.error('经费来源 与 经费支出 金额不一致');
            return false;
          }
          this.applyLoading = true;
          if (!sessionStorage.getItem(`${this.taskId}-contract-budgetId`)) {
            this.$api.kjxm.project.budgetAdd({
              ...this.formData7,
              projectId: this.projectId,
              contractId: sessionStorage.getItem(`${this.taskId}-contractId`)
            }).then(response => {
              sessionStorage.setItem(`${this.taskId}-contract-budgetId`, response.data.id)
              this.$message.success('提交成功');
              this.onCurChanged(8)
            }).catch((e) => {
              this.applyLoading = false;
              this.$message.error(e.toString());
            });
          } else {
            this.$api.kjxm.project.budgetEdit({
              ...this.formData7,
              id: sessionStorage.getItem(`${this.taskId}-contract-budgetId`),
              projectId: this.projectId,
              contractId: sessionStorage.getItem(`${this.taskId}-contractId`)
            }).then(response => {
              this.$message.success('提交成功');
              this.onCurChanged(8)
            }).catch((e) => {
              this.applyLoading = false;
              this.$message.error(e.toString());
            });
          }
        } else {
          const firstError = Object.values(validateResult)[0]?.[0]?.message;
          this.$message.error(firstError);
        }
      });
    },
    onSubmit8(){
      const isValidate = this.$refs["contract-terms"].checkData()
      if (!isValidate) {
        return false;
      }
      this.applyLoading = true;
      this.formData8.terms = this.formData8.terms.map(val => ({...val, contractId: Number(sessionStorage.getItem(`${this.taskId}-contractId`))}))
      this.$api.kjxm.contract.TermsAdd(this.formData8.terms).then(response => {
        this.$message.success('提交成功');
        sessionStorage.setItem(`${this.taskId}-contract-termsId`,this.formData8.terms.length)
        this.onCurChanged(9)
      }).catch((e) => {
        this.applyLoading = false;
        this.$message.error(e.toString());
      });
    },
    onSubmit9(){
      this.$refs.form.validate().then((validateResult) => {
        if (validateResult === true) {
          this.applyLoading = true;
          if (!sessionStorage.getItem(`${this.taskId}-contract-reviewId`)) {
            this.$api.kjxm.contract.projectContractExplainAdd({
              ...this.formData9,
              projectId: this.projectId,
              contractId:Number(sessionStorage.getItem(`${this.taskId}-contractId`)),
            }).then(response => {
              sessionStorage.setItem(`${this.taskId}-contract-reviewId`, response.data.id)
              this.$message.success('提交成功');
              this.onCurChanged(10)
            }).catch((e) => {
              this.applyLoading = false;
              this.$message.error(e.toString());
            });
          } else {
            this.$api.kjxm.contract.projectContractExplainUpdate({
              ...this.formData9,
              id: sessionStorage.getItem(`${this.taskId}-contract-reviewId`),
              projectId: this.projectId,
              contractId:Number(sessionStorage.getItem(`${this.taskId}-contractId`)),
            }).then(response => {
              this.$message.success('提交成功');
              this.onCurChanged(10)
            }).catch((e) => {
              this.applyLoading = false;
              this.$message.error(e.toString());
            });
          }
        } else {
          const firstError = Object.values(validateResult)[0]?.[0]?.message;
          this.$message.error(firstError);
        }
      });
    },
    onSubmit10(type){
      if(type === 1){
        this.applyLoading = true;
        if (!sessionStorage.getItem(`${this.taskId}-contract-otherId`)) {
          this.$api.kjxm.contract.contractOthersAdd({
            ...this.formData10,
            contractId:Number(sessionStorage.getItem(`${this.taskId}-contractId`)),
            projectId:this.projectId,
            expectResult: this.formData10.expectResultList.join(",")

          }).then(response => {
            sessionStorage.setItem(`${this.taskId}-contract-otherId`, response.data.id)
            this.$message.success('暂存成功');
            this.applyLoading = false;
          }).catch((e) => {
            this.applyLoading = false;
            this.$message.error(e.toString());
          });
        } else {
          this.$api.kjxm.contract.contractOthersUpdate({
            ...this.formData10,
            id: sessionStorage.getItem(`${this.taskId}-contract-otherId`),
            contractId:Number(sessionStorage.getItem(`${this.taskId}-contractId`)),
            projectId:this.projectId,
            expectResult: this.formData10.expectResultList.join(",")
          }).then(response => {
            this.$message.success('暂存成功');
            this.applyLoading = false;
          }).catch((e) => {
            this.applyLoading = false;
            this.$message.error(e.toString());
          });
        }
      }else {
        this.$refs.form.validate().then((validateResult) => {
          if (validateResult === true) {
            if(this.isOldProject !=='1'){
              // 判断所有步骤是否是提交不是则提示错误
              if (!sessionStorage.getItem(`${this.taskId}-contract-contractId`)) {
                this.$message.error("基本信息还未提交")
                this.applyLoading = false;
                return false;
              }
              if (!sessionStorage.getItem(`${this.taskId}-contract-purposeContentId`)) {
                this.$message.error("研究的主要目的、内容还未提交")
                this.applyLoading = false;
                return false;
              }

              if (!sessionStorage.getItem(`${this.taskId}-contract-assessIndexId`)) {
                this.$message.error("考核指标还未提交");
                this.applyLoading = false;
                return false;
              }

              if (!sessionStorage.getItem(`${this.taskId}-contract-researchPlanId`)) {
                this.$message.error("研究的年度计划、目标还未提交");
                this.applyLoading = false;
                return false;
              }
              if (!sessionStorage.getItem(`${this.taskId}-contract-resultsId`)) {
                this.$message.error("成果及知识产权的归属与保护还未提交");
                this.applyLoading = false;
                return false;
              }

              if (!sessionStorage.getItem(`${this.taskId}-contract-companyId`)) {
                this.$message.error("单位信息还未提交");
                this.applyLoading = false;
                return false;
              }
            }

            if (!sessionStorage.getItem(`${this.taskId}-contract-memberId`)) {
              this.$message.error("研究人员还未提交");
              this.applyLoading = false;
              return false;
            }

            if (!sessionStorage.getItem(`${this.taskId}-contract-budgetId`)) {
              this.$message.error("经费预算还未提交");
              this.applyLoading = false;
              return false;
            }
            if (!sessionStorage.getItem(`${this.taskId}-contract-termsId`)) {
              this.$message.error("共同条款还未提交");
              this.applyLoading = false;
              return false;
            }
            this.isCommit = true;
            this.applyLoading = true;
            if (!sessionStorage.getItem(`${this.taskId}-contract-otherId`)) {
              this.$api.kjxm.contract.contractOthersAdd({
                ...this.formData10,
                contractId:Number(sessionStorage.getItem(`${this.taskId}-contractId`)),
                projectId:this.projectId,
                expectResult: this.formData10.expectResultList.join(",")
              }).then(response => {
                sessionStorage.setItem(`${this.taskId}-contract-otherId`, response.data.id)
                if(this.isOldProject === '1'){
                  this.$message.success('提交成功');
                  this.onCurChanged(11)
                }else {
                  this.$api.kjxm.contract.submit({
                    projectId: this.projectId,
                    id: sessionStorage.getItem(`${this.taskId}-contractId`)
                  }).then(response => {
                    this.$message.success('提交成功');
                    this.applyLoading = false;
                    this.close();
                  }).catch((e) => {
                    this.isCommit = false;
                    this.applyLoading = false;
                    this.$message.error(e.toString());
                  });
                }

              }).catch((e) => {
                this.isCommit = false;
                this.applyLoading = false;
                this.$message.error(e.toString());
              });
            } else {
              this.$api.kjxm.contract.contractOthersUpdate({
                ...this.formData10,
                id: sessionStorage.getItem(`${this.taskId}-contract-otherId`),
                contractId:Number(sessionStorage.getItem(`${this.taskId}-contractId`)),
                projectId:this.projectId,
                expectResult: this.formData10.expectResultList.join(",")
              }).then(response => {
                if(this.isOldProject === '1'){
                  this.$message.success('提交成功');
                  this.onCurChanged(11)
                }else {
                  this.$api.kjxm.contract.submit({
                    projectId: this.projectId,
                    id: sessionStorage.getItem(`${this.taskId}-contractId`)
                  }).then(response => {
                    this.$message.success('提交成功');
                    this.applyLoading = false;
                    this.close();
                  }).catch((e) => {
                    this.isCommit = false;
                    this.applyLoading = false;
                    this.$message.error(e.toString());
                  });
                }
              }).catch((e) => {
                this.isCommit = false;
                this.applyLoading = false;
                this.$message.error(e.toString());
              });
            }
          }else{
            const firstError = Object.values(validateResult)[0]?.[0]?.message;
            this.$message.error(firstError);
          }
        });
      }
    },
    onSubmit11(){
      if (!sessionStorage.getItem(`${this.taskId}-contract-contractId`)) {
        this.$message.error("基本信息还未提交")
        this.applyLoading = false;
        return false;
      }
      if (!sessionStorage.getItem(`${this.taskId}-contract-purposeContentId`)) {
        this.$message.error("研究的主要目的、内容还未提交")
        this.applyLoading = false;
        return false;
      }

      if (!sessionStorage.getItem(`${this.taskId}-contract-assessIndexId`)) {
        this.$message.error("考核指标还未提交");
        this.applyLoading = false;
        return false;
      }

      if (!sessionStorage.getItem(`${this.taskId}-contract-researchPlanId`)) {
        this.$message.error("研究的年度计划、目标还未提交");
        this.applyLoading = false;
        return false;
      }
      if (!sessionStorage.getItem(`${this.taskId}-contract-resultsId`)) {
        this.$message.error("成果及知识产权的归属与保护还未提交");
        this.applyLoading = false;
        return false;
      }

      if (!sessionStorage.getItem(`${this.taskId}-contract-companyId`)) {
        this.$message.error("单位信息还未提交");
        this.applyLoading = false;
        return false;
      }
      if (!sessionStorage.getItem(`${this.taskId}-contract-memberId`)) {
        this.$message.error("研究人员还未提交");
        this.applyLoading = false;
        return false;
      }
      if (!sessionStorage.getItem(`${this.taskId}-contract-budgetId`)) {
        this.$message.error("经费预算还未提交");
        this.applyLoading = false;
        return false;
      }
      if (!sessionStorage.getItem(`${this.taskId}-contract-termsId`)) {
        this.$message.error("共同条款还未提交");
        this.applyLoading = false;
        return false;
      }
      if (!sessionStorage.getItem(`${this.taskId}-contract-otherId`)) {
        this.$message.error("项目信息表还未提交");
        this.applyLoading = false;
        return false;
      }
      if (this.projectFileData[0].fileIds.length <= 0) {
        this.$message.error("需要上传已盖章任务书");
        return false;
      }
      const sysAttMainIds = []
      this.projectFileData.forEach(val=>{
        sysAttMainIds.push(...val.fileIds)
      })
      this.loading = true;
      this.applyLoading = true;
      this.$api.kjxm.project.edit({
        id: this.projectId,
        sysAttMainVo: {
          sysAttMainIds
        }
      }).then(response => {
        sessionStorage.setItem(`${this.taskId}-contract-fileId`, '1')
        this.$api.kjxm.contract.oldSubmit({
          projectId: this.projectId,
          id: sessionStorage.getItem(`${this.taskId}-contractId`)
        }).then(response => {
          this.$message.success('提交成功');
          this.applyLoading = false;
          this.close();
        }).catch((e) => {
          this.loading = false;
          this.applyLoading = false;
          this.$message.error(e.toString());
        });
      }).catch((e) => {
        this.applyLoading = false;
        this.loading = false;
        this.$message.error(e.toString());
      });
    },
    close(){
      this.applyLoading = false;
      setTimeout(() => {
        this.$tab.closeOpenPage({path: "/kjxm/contract/project-my"});
      }, 1000)
    }
  }
}
</script>

<style lang="less" scoped>
.step-form {
  padding: 0 24px;
}

.t-row {
  margin-bottom: 14px;
}

.step-card {
  height: 100%;
  margin-bottom: 14px;
}

.table-form{
  /deep/ .t-radio.t-is-disabled .t-radio__label{
    color: unset
  }
  /deep/ .t-is-error .t-input__extra{
    position: static;
  }
  /deep/ .t-form__label{
    display: none;
  }
  .t-form__item{
    width: 100%;
  }
  .t-row{
    align-items: stretch;
    margin-bottom: 0px;
    .require {
      color: red;
      margin-right: 3px;
    }
    .t-col{
      border: 1px solid #ddd;
      color: #333;
      min-height: 37px;
      padding: 4px !important;
      //overflow: hidden;
      display: flex;
      align-items: center;
      margin:0px -1px -1px 0px;
    }
    .title{
      background-color: #FAFAFA;
      justify-content: center;
      margin:0px -1px -1px 0px;
      color: #606266;
    }
  }
}

</style>
